class_name ItemRecipe extends Resource

@export var target_id: String
@export var item1_id: String
@export var item2_id: String

## 武器1，武器2，目标武器
func _init(_item1_id = null, _item2_id = null, _target_id = null) -> void:
	if _item1_id != null:
		item1_id = _item1_id
	if _item2_id != null:
		item2_id = _item2_id
	if _target_id != null:
		target_id = _target_id
	
static func make_signature(dict:Dictionary) -> String:
	# dict: {id:int}
	var pairs := []
	for id in dict.keys():
		pairs.append("%s" % [id])
	pairs.sort()                 # 顺序无关 → 排序后唯一
	return "|".join(pairs)       # 1|2

func get_signature() -> String:
	var dict = {}
	dict.get_or_add(item1_id)
	dict.get_or_add(item2_id)
	return make_signature(dict)
